﻿using NHibernate;

namespace DataLayer.UoW
{
    /// <summary>
    /// To shield the client from  all NHibernate specifics.
    /// Basically a wrapper around the NHibernate Session.
    /// </summary>
    public class GenericTransaction : IGenericTransaction
    {
        private readonly ITransaction transaction;

        public GenericTransaction(ITransaction transaction)
        {
            this.transaction = transaction;
        }

        #region IGenericTransaction Members

        public void Commit()
        {
            transaction.Commit();
        }

        public void Rollback()
        {
            transaction.Rollback();
        }

        #endregion

        #region IDisposable Members

        public void Dispose()
        {
            transaction.Dispose();
        }

        #endregion
    }
}
